<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
	<meta charset="UTF-8">
	<title>活动报名详情页</title>
	<meta name="page-view-size" content="1280*720">
	<link rel="stylesheet" href="../css/base.css">
	<!-- <link rel="stylesheet" href="../css/login.css"> -->
	<script type="text/javascript" src="../lib/js/evm.js"></script>
	<script type="text/javascript" src="../lib/js/Evm_djyw.js"></script>
	<script type="text/javascript" src="../lib/js/key.js"></script>
	<script src="../js/qrcode.min.js"></script>
	<script src="../lib/js/md5.js" type="text/javascript" charset="utf-8"></script>
	<script src="../lib/js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../lib/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/api.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/public.js" type="text/javascript" charet="utf-8"></script>
	<style>
		.detail-bg {
			width: 1280px;
			height: 720px;
			position: relative;
			top: 0;
			left: 0;
			background: url(../images/bg.png) no-repeat left top;
		}

		.whiteBg {
			width: 1120px;
			height: 530px;
			position: absolute;
			top: 50%;
			left: 50%;
			margin-left: -560px;
			margin-top: -214px;
			background-color: rgba(0, 0, 0, 0.3);
			border-radius: 10px;
			box-sizing: border-box;
		}

		.detailImg {
			width: 294px;
			height: 166px;
			overflow: hidden;
			position: absolute;
			left: 40px;
			top: 110px;
			border-radius: 10px;
		}

		.detaiPic {
			width: 100%;
			height: 100%;
			overflow: hidden;
		}

		.detailBtn {
			/*width: 290px;
				height: 54px;*/
			background: rgba(249, 140, 46, 1);
			border-radius: 15px;
			color: #ffffff;
			font-size: 24px;
			text-align: center;
			position: absolute;
			top: 300px;
			left: 40px;
			line-height: 54px;
			border: 5px solid lightgreen;
		}

		.detailMsg {
			width: 724px;
			height: 450px;
			position: absolute;
			right: 28px;
			top: 70px;
			box-sizing: border-box;
			overflow: hidden;
			/* background: pink; */
		}

		.detailRow {
			width: 100%;
			float: left;
			box-sizing: border-box;
			overflow: hidden;
			margin-top: 10px;
		}

		.detailName {
			width: 120px;
			font-size: 24px;
			font-weight: bold;
			float: left;
			color: rgba(255, 216, 0, 1);
			line-height: 36px;
		}

		.title {
			width: 100%;
			display: block;
			height: 40px;
			line-height: 40px;
			text-align: center;
			font-size: 28px;
			color: white;
			position: absolute;
			top: 17px;
		}

		.detailTxt {
			width: 600px;
			float: right;
			font-size: 22px;
			font-weight: 400;
			color: white;
			line-height: 36px;
		}
		.showyugao{
			display: none;
		}
		.showtrue{
			display: block;
			}
	</style>
</head>

<body>
	<div class="detail-bg">
		<div class="whiteBg">
			<span class="title">
			</span>
			<div class="detailImg">
				<img src="" class="detaiPic">
			</div>
			<div class="detailBtn"></div>
			<div class="detailMsg">
				<div class="detailRow">
					<div class="detailName">联 系 人：</div>
					<div class="detailTxt  contacter"></div>
				</div>
				<div class="detailRow">
					<div class="detailName">联系方式：</div>
					<div class="detailTxt phone"></div>
				</div>
				<div class="detailRow showyugao">
					<div class="detailName">活动时间：</div>
					<div class="detailTxt activeTime"></div>
				</div>
				<div class="detailRow showtrue">
					<div class="detailName">开始时间：</div>
					<div class="detailTxt startTime">

					</div>
				</div>
				<div class="detailRow showtrue">
					<div class="detailName">结束时间：</div>
					<div class="detailTxt endTime">

					</div>
				</div>
				<div class="detailRow ">
					<div class="detailName">活动地址：</div>
					<div class="detailTxt address">

					</div>
				</div>
				<div class="detailRow">
					<div class="detailName">活动内容：</div>
					<div class="detailTxt content">

					</div>
				</div>
			</div>

		</div>
	</div>
</body>
<script>
	var status = '';
	TV.structure('志愿活动')

	GetDatas('getActivity', {
		id: TV.GetParam()
	}, function (res, data) {
		var data = data.data;
		console.log(data)
		$('.title').html(data.title)
		$('.contacter').html(data.contacter)
		$('.activeTime').html(data.activity_time)
		$('.startTime').html(data.format_start_time)
		$('.endTime').html(data.format_end_time)
		$('.phone').html(data.phone)
		$('.address').html(data.address)
		if (data.images == null || data.images == "") {
			var img = '../images/nonePic.png';
		} else {
			var img = API_URL.imgURL + data.images;
		}

		$(".detaiPic").attr("src", img);
		$('.content').html(data.content)
		if (TV.GetParam('show') == '999') {
			$('.detailBtn').css("display", "none")
			
			$('.showyugao').css("display", "block")
			$('.showtrue').css("display", "none")
		} else {
			status = data.status;
			if (status == '2') {
				$('.detailBtn').html("已结束")
				$('.detailBtn').css("background", "gray")
				$('.detailBtn').css("width", "290px")
				$('.detailBtn').css("height", "54px")
			} else {
				var qrcode = new QRCode($(".detailBtn")[0], {
					width: 150,
					height: 150,
					correctLevel: QRCode.CorrectLevel.L
				});
				qrcode.makeCode(data.url);
				$('.detailBtn').css("border", "none")
				$('.detailBtn').css("margin-left", "75px")
			}
		}

	})

	function direEnter() {

		if (TV.GetParam('show') == '999') {

		} else {
			if (status == '2') {

			} else {
				var nick_name = $.cookie('TV_CST_NAME');
				var access_token = $.cookie('TV_CST_TOKEN');
				var phone = $.cookie('TV_CST_MOBILE');
				// alert(ctitle)
				var param = {
					access_token: access_token,
					id: TV.GetParam('id'),

				}

				GetDatas('join', param, function (err, res) {
					// TV.PromptMsg(res.code)
					if (res.code == 0) {

						TV.PromptMsg("报名成功")
					} else if (res.code == 10009) {
						TV.userLogin();
						direEnter(index);
					} else if (res.code == 10002) {
						TV.PromptMsg("请登录")
						setTimeout(function () {
							window.location.href = 'login.html'
						}, 1000);
					} else {
						var message = res.message
						TV.PromptMsg(message)
					}
				})
			}
		}


	}
</script>
<script src="../js/login.js"></script>

</html>